package com.threeti.mecool.core.domain.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.threeti.mecool.core.domain.model.acl.User;
import com.threeti.mecool.framework.domain.support.DefaultDomainEntity;
import com.threeti.mecool.legacy.domain.model.basicdata.biz.PosLegacy;

/**
 * 备忘 <p>
 * 
 * 1.备忘经由项目门店，实际绑上的是 系统通路(来自于遗留系统)<br/>
 * 2.用户在添加计划，选择项目门店时，由于项目门店指向特定的系统通路，因此可以看到绑定在该通路下的用户自己的(历史)备忘<br/>
 * 3.用户间的备忘不能共享
 * 
 * @author Jay Meng
 */
@Entity
@Table(name="DM_MEMO")
public class Memo extends DefaultDomainEntity {
  @ManyToOne
  @JoinColumn(name = "USER_ID")
  private User user;
  
  @ManyToOne
  private PosLegacy channel;
  
  private String content;
  
  private Date recordDate = new Date();

   public Memo(User user, PosLegacy channel, String content) {
    super();
    this.user = user;
    this.channel = channel;
    this.content = content;
  }

  /** 填写备忘的用户 */
  public User getUser() {
    return user;
  }

  /** 备忘绑定的通路(终端) TODO jay:change to ChannelSync*/
  public PosLegacy getChannel() {
    return channel;
  }

  /** 备忘内容 */
  public String getContent() {
    return content;
  }

  /** 备忘时间 */
  public Date getRecordDate() {
    return recordDate;
  }

  @Override
  public String toString() {
    return "Memo [user=" + user + ", channel=" + channel == null ? "" :channel.getCode() + ", content=" + content + "]";
  }

  public Memo() {
    super();
  }

  public void setUser(User user) {
    this.user = user;
  }

  public void setContent(String content) {
    this.content = content;
  }
  
  
}
